package com.app.demo.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class MyDBHelper extends SQLiteOpenHelper {
private static final String DBNAME="my.db";
private static final int VERSION=1;
    public MyDBHelper(Context context) {
        super(context, DBNAME, null, VERSION);
    }
    String sql = "CREATE TABLE tb_userinfo (\n" +
            "    id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
            "    name VARCHAR(10),\n" +
            "    pwd VARCHAR(15),\n" +
            "    phone VARCHAR(11)\n" +
            ");\n";
    //创建数据库
    @Override
    public void onCreate(SQLiteDatabase db) {
        //创建数据表
//        db.execSQL("create table tb_userinfo(id interger primary key autoincrement,name varchar(10),pwd varchar(15),phone varchar(11))");
        db.execSQL(sql);

    }

    //升级数据库
    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
